﻿using LJ.DataAccess.Abstractions.DataObject;
using System.Linq.Expressions;

namespace LJ.DataAccess.Abstractions;

/// <summary>
/// 数据提供器
/// </summary>
public interface IDataProvider
{

}

/// <summary>
/// 数据提供器
/// </summary>
/// <typeparam name="T"></typeparam>
public interface IDataProvider<T> : IDataProvider where T : class, IEntityObject
{
    Task<T?> FirstOrDefaultAsync(Expression<Func<T, bool>> predicate, CancellationToken cancellationToken = default);

    Task AddAsync(T entityObject, CancellationToken cancellationToken = default);

    Task UpdateAsync(T entityObject, CancellationToken cancellationToken = default);

    Task DeleteAsync(T entityObject, CancellationToken cancellationToken = default);
}